﻿using System;
using System.Windows.Controls;
using NSubstitute;
using Phoenix.ActionResults;
using Phoenix.Framework;

namespace Phoenix.Tests.ActionResults
{
    public class ViewResultTests
    {
        readonly TestViewActionResult actionResultUnderTest;
        readonly ViewModelBase viewModel;
        readonly ControllerActionContext controllerActionContext;

        public ViewResultTests()
        {
            viewModel = Substitute.For<ViewModelBase>();
            controllerActionContext = PhoenixObjectMother.CreateContext(new ControllerAction("Controller", "Test", null));
            controllerActionContext.Host.ViewLocator.Locate(new ControllerAction("Controller", "Test", null)).Returns(new UserControl());
            actionResultUnderTest = new TestViewActionResult("Test", viewModel, controllerActionContext);
        }

        public class TestViewActionResult : ViewActionResult
        {
            public TestViewActionResult(string viewName, ViewModelBase viewModel, ControllerActionContext context) :
                base(viewName, viewModel, context)
            {
            }

            protected override void RenderView(Control view)
            { }
        }
    }
}